<?php include('app/admin/welcome/html/meta.html');?>
<?php include('app/admin/welcome/html/header.html');?>
<?php include('app/admin/welcome/html/menu.html');?>

<section class="Hui-article-box">
	<nav class="breadcrumb"><i class="Hui-iconfont"></i>
		<a href="/" class="maincolor">首页</a>
		<span class="c-999 en">&gt;</span>
		<span class="c-666">我的桌面</span>
		<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
	</nav>
	<div class="Hui-article">

		<article class="page-container">
			<form class="form form-horizontal" id="form-article-add" method="post">
				<input style="display: none;" type="text" name="Id" id="Id" value="<?php echo $re['Id']?>" />
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span>密码：</label>
					<div class="formControls col-xs-6 col-sm-7">
						<input type="password" class="input-text" value="" placeholder="" id="password" name="password">
					</div>
					<div id="passwordtick" style="color: red;" class="formControls col-xs-2 col-sm-2"></div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span>确认密码：</label>
					<div class="formControls col-xs-6 col-sm-7">
						<input type="password" class="input-text" value="" placeholder="" id="psd_confirm" name="psd_confirm">
					</div>
					<div id="psd_confirmtick" style="color: red;" class="formControls col-xs-2 col-sm-2"></div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span>昵称：</label>
					<div class="formControls col-xs-6 col-sm-7">
						<input type="text" class="input-text" value="" placeholder="" id="nickname" name="nickname">
					</div>
					<div id="nicknametick" style="color: red;" class="formControls col-xs-2 col-sm-2"></div>
				</div>
				<div class="row cl">
					<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
						<button id="submit" class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存并提交</button>
						<button class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
					</div>
				</div>
			</form>
		</article>
	</div>
</section>

<?php include('app/admin/welcome/html/footer.html');?>

<!--请在下方写此页面业务相关的脚本-->

<!-- 配置文件 -->
<script type="text/javascript" src="static/lib/ueditor/1.4.3/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="static/lib/ueditor/1.4.3/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
        
    //密码格式判断
    $('#password').blur(function(){
    	var password = $(this).val();
		if(password == '')
		{
			$('#passwordtick').text('密码不能为空！');
			return false;
		}else
		{
			$('#passwordtick').text('');
			return false;
		}		
    })
    
    //确认密码格式判断
    $('#psd_confirm').blur(function(){
    	var psd_confirm = $(this).val();
    	var password = $('#password').val();
    	switch(psd_confirm)
    	{
    		case '':
    			$('#psd_confirmtick').text('');
    			$('#psd_confirmtick').text('密码不能为空！');
    		break;
    		case password:
    			$('#psd_confirmtick').text('');
    		break;
    		default:
    			$('#psd_confirmtick').text('');
    			$('#psd_confirmtick').text('密码不一致，请重新输入！');
    	}	
    })
    
    //昵称格式判断
    $('#nickname').blur(function(){
    	var nicknames = $(this).val();
		$.get('index.php?a=admin&b=maneger&c=update&nickname_flag=selct',
			{nickname:nicknames},function(data){
			if(data == 12001)
			{
				$('#nicknametick').text('');
    			$('#nicknametick').text('昵称已存在！');
    			return false;
			}else 
			{
				$('#nicknametick').text('');
				return false;
			}
		})
  	})
    
    $('#submit').click(function(){
		var urls = 'index.php?a=admin&b=maneger&c=update';	
		var password = $('#password').val();
		var psd_confirm = $('#psd_confirm').val();
		var nickname = $('#nickname').val();
		
		var passwordtick = $('#passwordtick').val();
		var psd_confirmtick = $('#psd_confirmtick').val();
		var nicknametick = $('#nicknametick').val();
		var fd = new FormData($("#form-article-add"));
		if(
			password != '' &&
			psd_confirm != '' &&
			nickname != '' &&
			passwordtick == ''&&
			psd_confirmtick == ''&&
			nicknametick == ''
		)
		{
			$.ajax({
				type:"post",
				url:urls,
				data:fd,
				async:true,
				success:function(data)
				{
					if(data == 10086)
					{
						alert('修改成功');
						window.location = 'index.php?a=admin&b=maneger&c=index';
						return false;
					}else if(data == 10087)
					{
						alert('修改失败');
						return false;
					}
				}
			})
		}else
		{
			alert('信息不完整，请重新输入！');
			return false;	
		}
		return false;
	})
</script>
<!--/请在上方写此页面业务相关的脚本-->

</body>

</html>